package com.shop2cn.iapi.couponmanage.testcase.old;

import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.springframework.context.annotation.Bean;

import com.shop2cn.iapi.couponmanage.parameter.CouponValue;
import com.shop2cn.iapi.couponmanage.parameter.CreateCouponBean;
import com.shop2cn.iapi.couponmanage.service.CreateCouponCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P1;
import com.ymttest.business.service.CouponShop2cnMCallService;
import com.ymttest.database.model.YmtCoupon;
import com.ymttest.database.model.coupon;
import com.ymttest.database.model.couponbatch;
import com.ymttest.database.model.YmtCouponGenerateSubTask;
import com.ymttest.database.model.YmtCouponGenerateTask;
import com.ymttest.database.model.YmtCouponProduct;
import com.ymttest.database.model.YmtCouponScenario;
import com.ymttest.database.model.YmtCouponSetting;
import com.ymttest.database.model.YmtCouponValue;
import com.ymttest.database.model.couponbatch;
import com.ymttest.database.model.couponbatchext;
import com.ymttest.database.model.couponsequence;
import com.ymttest.database.model.couponusecondition;
import com.ymttest.database.sqlwapper.couponWapper;
import com.ymttest.database.sqlwapper.couponbatchWapper;
import com.ymttest.database.sqlwapper.YmtCouponGenerateSubTaskWapper;
import com.ymttest.database.sqlwapper.YmtCouponGenerateTaskWapper;
import com.ymttest.database.sqlwapper.YmtCouponProductWapper;
import com.ymttest.database.sqlwapper.YmtCouponScenarioWapper;
import com.ymttest.database.sqlwapper.YmtCouponSequenceWapper;
import com.ymttest.database.sqlwapper.YmtCouponSettingWapper;
import com.ymttest.database.sqlwapper.YmtCouponValueWapper;
import com.ymttest.database.sqlwapper.YmtCouponWapper;
import com.ymttest.database.sqlwapper.couponbatchWapper;
import com.ymttest.database.sqlwapper.couponbatchextWapper;
import com.ymttest.database.sqlwapper.couponsequenceWapper;
import com.ymttest.database.sqlwapper.couponuseconditionWapper;
import com.ymttest.utils.EnvSetup;
import com.ymttest.utils.TestDataManager;

/**
 * 创建批次接口 FreeMaker Template自动生成代码
 */
@TestSuite
public class Ts_CreateCoupon {
    private static CreateCouponBean createcouponBean;
    private static CreateCouponCall createcouponCall;

    @BeforeClass
    public static void setUp() {
        Logger.createResultFile("创建批次接口");
    }

    @Before
    public void caseUp() {
        createcouponBean = new CreateCouponBean();
        createcouponCall = new CreateCouponCall();
    }

    @AfterClass
    public static void tearDown() {
        Logger.generateResult(createcouponCall.getOpurl());
    }

    @After
    public void caseDown() {
        Logger.end();
    }

    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_001() {
        Logger.start(true, "正例-创建批次-SendType为1:短码发放（需要创建子任务）");
        try {
   
            setDefaultCreateCouponBean();
            createcouponBean.setSendType(1);
            createcouponBean.setAcquireCouponMethod(2);

            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

        	Logger.verifyEquals("2", createcouponCall.getCode(), "验证返回code");
			Logger.verifyIsContains(true, createcouponCall.getMessage().contains("不能创建短码优惠券"), "验证返回Message");

        } catch (Exception e) {
            Logger.fail(e);
        }
    }

    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_002() {
        Logger.start(true, "正例-创建批次-SendType为2:链接发放");
        try {
        	setDefaultCreateCouponBean();
            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

            verifyReturn();

        } catch (Exception e) {
            Logger.fail(e);
        }
    }

    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_003() {
        Logger.start(true, "正例-创建批次-链接-UserType为0：全部用户");
        try {

            setDefaultCreateCouponBean();
            createcouponBean.setUserType(0);
            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

            verifyReturn();

        } catch (Exception e) {
            Logger.fail(e);
        }
    }

    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_004() {
        Logger.start(true, "正例-创建批次-链接-UserType为1：新用户");
        try {

            setDefaultCreateCouponBean();
            createcouponBean.setUserType(1);

            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

            verifyReturn();

        } catch (Exception e) {
            Logger.fail(e);
        }
    }

    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_005() {
        Logger.start(true, "正例-创建批次-链接-UserType为2：老用户");
        try {

            setDefaultCreateCouponBean();
            createcouponBean.setUserType(2);

            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

            verifyReturn();

        } catch (Exception e) {
            Logger.fail(e);
        }
    }

    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_006() {
        Logger.start(true, "正例-创建批次-链接-UsePlatforms下单平台限制：不传为无限制");
        try {

            setDefaultCreateCouponBean();
            List<Integer> list = new ArrayList<Integer>();

            createcouponBean.setUsePlatforms(list);
            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

            verifyReturn();

        } catch (Exception e) {
            Logger.fail(e);
        }
    }

    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_007() {
        Logger.start(true, "正例-创建批次-链接-UsePlatforms下单平台限制：PC：1");
        try {

            setDefaultCreateCouponBean();

            List<Integer> list = new ArrayList<Integer>();
            list.add(1);

            createcouponBean.setUsePlatforms(list);
            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

            verifyReturn();

        } catch (Exception e) {
            Logger.fail(e);
        }
    }

    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_008() {
        Logger.start(true, "正例-创建批次-链接-UsePlatforms下单平台限制：PC：6");
        try {

            setDefaultCreateCouponBean();

            List<Integer> list = new ArrayList<Integer>();
            list.add(6);

            createcouponBean.setUsePlatforms(list);
            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

            verifyReturn();

        } catch (Exception e) {
            Logger.fail(e);
        }
    }

    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_009() {
        Logger.start(true, "正例-创建批次-链接-UsePlatforms下单平台限制：PC：12");
        try {

            setDefaultCreateCouponBean();

            List<Integer> list = new ArrayList<Integer>();
            list.add(12);

            createcouponBean.setUsePlatforms(list);
            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

            verifyReturn();

        } catch (Exception e) {
            Logger.fail(e);
        }
    }

    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_010() {
        Logger.start(true, "正例-创建批次-链接-UsePlatforms下单平台限制：APP：3");
        try {

            setDefaultCreateCouponBean();

            List<Integer> list = new ArrayList<Integer>();
            list.add(3);

            createcouponBean.setUsePlatforms(list);

            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

            verifyReturn();

        } catch (Exception e) {
            Logger.fail(e);
        }
    }

    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_011() {
        Logger.start(true, "正例-创建批次-链接-UsePlatforms下单平台限制：APP：4");
        try {

            setDefaultCreateCouponBean();

            List<Integer> list = new ArrayList<Integer>();
            list.add(4);

            createcouponBean.setUsePlatforms(list);
            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

            verifyReturn();

        } catch (Exception e) {
            Logger.fail(e);
        }
    }

    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_012() {
        Logger.start(true, "正例-创建批次-链接-UsePlatforms下单平台限制：APP：7");
        try {

            setDefaultCreateCouponBean();

            List<Integer> list = new ArrayList<Integer>();
            list.add(7);

            createcouponBean.setUsePlatforms(list);

            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

            verifyReturn();

        } catch (Exception e) {
            Logger.fail(e);
        }
    }

    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_013() {
        Logger.start(true, "正例-创建批次-链接-UsePlatforms下单平台限制：APP：8");
        try {

            setDefaultCreateCouponBean();

            List<Integer> list = new ArrayList<Integer>();
            list.add(8);

            createcouponBean.setUsePlatforms(list);

            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

            verifyReturn();

        } catch (Exception e) {
            Logger.fail(e);
        }
    }

    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_014() {
        Logger.start(true, "正例-创建批次-链接-UsePlatforms下单平台限制：APP：10");
        try {

            setDefaultCreateCouponBean();

            List<Integer> list = new ArrayList<Integer>();
            list.add(10);

            createcouponBean.setUsePlatforms(list);
            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

            verifyReturn();

        } catch (Exception e) {
            Logger.fail(e);
        }
    }

    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_015() {
        Logger.start(true, "正例-创建批次-链接-UsePlatforms下单平台限制：APP：11");
        try {

            setDefaultCreateCouponBean();

            List<Integer> list = new ArrayList<Integer>();
            list.add(11);

            createcouponBean.setUsePlatforms(list);

            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

            verifyReturn();

        } catch (Exception e) {
            Logger.fail(e);
        }
    }

    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_016() {
        Logger.start(true, "正例-创建批次-链接-UsePlatforms下单平台限制：WAP：2");
        try {

            setDefaultCreateCouponBean();

            List<Integer> list = new ArrayList<Integer>();
            list.add(2);

            createcouponBean.setUsePlatforms(list);
            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

            verifyReturn();

        } catch (Exception e) {
            Logger.fail(e);
        }
    }

    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_017() {
        Logger.start(true, "正例-创建批次-链接-UsePlatforms下单平台限制：WAP：5");
        try {

            setDefaultCreateCouponBean();

            List<Integer> list = new ArrayList<Integer>();
            list.add(5);

            createcouponBean.setUsePlatforms(list);
            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

            verifyReturn();

        } catch (Exception e) {
            Logger.fail(e);
        }
    }

    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_018() {
        Logger.start(true, "正例-创建批次-链接-UsePlatforms下单平台限制：WAP：9");
        try {

            setDefaultCreateCouponBean();

            List<Integer> list = new ArrayList<Integer>();
            list.add(9);

            createcouponBean.setUsePlatforms(list);

            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

            verifyReturn();

        } catch (Exception e) {
            Logger.fail(e);
        }
    }

    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_099() {
        Logger.start(true, "正例-创建批次-链接-UsePlatforms下单平台限制：PC：1,6,12");
        try {

            setDefaultCreateCouponBean();
            List<Integer> list = new ArrayList<Integer>();
            list.add(1);
            list.add(6);
            list.add(12);
            
            createcouponBean.setUsePlatforms(list);

            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

            verifyReturn();

        } catch (Exception e) {
            Logger.fail(e);
        }
    }
    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_100() {
        Logger.start(true, "正例-创建批次-链接-UsePlatforms下单平台限制：APP：3,4,7,8,10,11");
        try {

            setDefaultCreateCouponBean();
            List<Integer> list = new ArrayList<Integer>();
            list.add(3);
            list.add(4);
            list.add(7);
            list.add(8);
            list.add(10);
            list.add(11);
            createcouponBean.setUsePlatforms(list);

            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

            verifyReturn();

        } catch (Exception e) {
            Logger.fail(e);
        }
    }

    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_102() {
        Logger.start(true, "正例-创建批次-链接-UsePlatforms下单平台限制：WAP：2,5,9");
        try {

            setDefaultCreateCouponBean();
            List<Integer> list = new ArrayList<Integer>();
            list.add(2);
            list.add(5);
            list.add(9);
            createcouponBean.setUsePlatforms(list);

            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

            verifyReturn();

        } catch (Exception e) {
            Logger.fail(e);
        }
    }
    
    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_101() {
        Logger.start(true, "正例-创建批次-链接-UsePlatforms下单平台限制：WAP：2,5,9");
        try {

            setDefaultCreateCouponBean();
            List<Integer> list = new ArrayList<Integer>();
            list.add(3);
            list.add(4);
            list.add(7);
            list.add(8);
            list.add(10);
            list.add(11);
            createcouponBean.setUsePlatforms(list);

            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

            verifyReturn();

        } catch (Exception e) {
            Logger.fail(e);
        }
    }
    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_103() {
        Logger.start(true, "正例-创建批次-链接-UsePlatforms下单平台限制：PC、APP、WAP同时存在");
        try {

            setDefaultCreateCouponBean();
            List<Integer> list = new ArrayList<Integer>();
            list.add(1);
            list.add(6);
            list.add(3);
            list.add(4);
            list.add(7);
            list.add(8);
            list.add(10);
            list.add(11);
            list.add(2);
            list.add(5);
            list.add(9);
            createcouponBean.setUsePlatforms(list);

            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

            verifyReturn();

        } catch (Exception e) {
            Logger.fail(e);
        }
    }
    
    
    
    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_114() {
        Logger.start(true, "正例-创建批次-链接-UsePlatforms下单平台限制：小程序：20（迭加业务）");
        try {

            setDefaultCreateCouponBean();
            List<Integer> list = new ArrayList<Integer>();
            list.add(20);
           
            createcouponBean.setUsePlatforms(list);

            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

            verifyReturn();

        } catch (Exception e) {
            Logger.fail(e);
        }
    }
    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_115() {
        Logger.start(true, "正例-创建批次-链接-UsePlatforms下单平台限制：直播小铺：21（迭加业务）");
        try {

            setDefaultCreateCouponBean();
            List<Integer> list = new ArrayList<Integer>();
            list.add(21);
           
            createcouponBean.setUsePlatforms(list);

            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

            verifyReturn();

        } catch (Exception e) {
            Logger.fail(e);
        }
    }
    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_116() {
        Logger.start(true, "正例-创建批次-链接-UsePlatforms下单平台限制：买家app小版本：22（迭加业务）");
        try {

            setDefaultCreateCouponBean();
            List<Integer> list = new ArrayList<Integer>();
            list.add(22);
           
            createcouponBean.setUsePlatforms(list);

            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

            verifyReturn();

        } catch (Exception e) {
            Logger.fail(e);
        }
    }
    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_019() {
        Logger.start(true, "正例-创建批次-链接-指定限制商品");
        try {

            setDefaultCreateCouponBean();

            List<String> list = new ArrayList<String>();
            list.add("qaffsfs");
            list.add("qaffsfsewrwer");
            list.add("qaffsfswerwqerqwrqw");

            createcouponBean.setProductIds(list);
            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

            verifyReturn();

        } catch (Exception e) {
            Logger.fail(e);
        }
    }

    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_020() {
        Logger.start(true, "正例-创建批次-链接-指定限制买手");
        try {

            setDefaultCreateCouponBean();

            List<Integer> list = new ArrayList<Integer>();
            list.add(Integer.parseInt(EnvSetup.getData("BuyUserId")));

            createcouponBean.setSellerIds(list);
            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

            verifyReturn();

        } catch (Exception e) {
            Logger.fail(e);
        }
    }

    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_021() {
        Logger.start(true, "正例-创建批次-链接-指定限制活动");
        try {

            setDefaultCreateCouponBean();

            List<Integer> list = new ArrayList<Integer>();
            list.add(1234);

            createcouponBean.setActivityIds(list);
            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

            verifyReturn();

        } catch (Exception e) {
            Logger.fail(e);
        }
    }

    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_022() {
        Logger.start(true, "正例-创建批次-链接-指定限制品牌");
        try {

            setDefaultCreateCouponBean();

            List<Integer> list = new ArrayList<Integer>();
            list.add(1234);

            createcouponBean.setBrands(list);
            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

            verifyReturn();

        } catch (Exception e) {
            Logger.fail(e);
        }
    }

    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_023() {
        Logger.start(true, "正例-创建批次-链接-指定限制分类");
        try {

            setDefaultCreateCouponBean();

            List<Integer> list = new ArrayList<Integer>();
            list.add(1);

            createcouponBean.setCategories(list);

            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

            verifyReturn();

        } catch (Exception e) {
            Logger.fail(e);
        }
    }

    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_104() {
        Logger.start(true, "正例-创建批次-链接-指定限制国家");
        try {

            setDefaultCreateCouponBean();

            List<Integer> list = new ArrayList<Integer>();
            list.add(1);

            createcouponBean.setCountrys(list);

            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

            verifyReturn();

        } catch (Exception e) {
            Logger.fail(e);
        }
    }
    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_105() {
        Logger.start(true, "正例-创建批次-链接-指定限制国家和分类");
        try {

            setDefaultCreateCouponBean();

            List<Integer> countrylist = new ArrayList<Integer>();
            countrylist.add(100);
            countrylist.add(101);
            List<Integer> Categorieslist = new ArrayList<Integer>();
            Categorieslist.add(1);
            Categorieslist.add(2);

            createcouponBean.setCountrys(countrylist);
            createcouponBean.setCategories(Categorieslist);

            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

            verifyReturn();

        } catch (Exception e) {
            Logger.fail(e);
        }
    }
    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_024() {
        Logger.start(false, "反例-创建批次-CouponBatch验证-优惠卷生成总数不能小于0");
        try {

            setDefaultCreateCouponBean();
            createcouponBean.setCouponNum(-1);

            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

//            Logger.verifyEquals("2", createcouponCall.getCode(),
//                    "验证返回StatusCode值");
            Logger.verifyEquals(true,
                    createcouponCall.getMessage().contains("优惠卷生成总数不能小于0"),
                    "验证返回Message值:优惠卷生成总数不能小于0");

        } catch (Exception e) {
            Logger.fail(e);
        }
    }

    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_025() {
        Logger.start(false, "反例-创建批次-CouponBatch验证-单用户使用最大次数不能小于0");
        try {

            setDefaultCreateCouponBean();
            createcouponBean.setPerUserReceiveMaxCount(-1);

            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

//            Logger.verifyEquals("2", createcouponCall.getCode(),
//                    "验证返回StatusCode值");
            Logger.verifyEquals(true,
                    createcouponCall.getMessage().contains("perUserReceiveMaxCount:单用户最大使用次数必须大于0"),
                    "验证返回Message值为：perUserReceiveMaxCount:单用户最大使用次数必须大于0");

        } catch (Exception e) {
            Logger.fail(e);
        }
    }

    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_026() {
        Logger.start(false, "反例-创建批次-CouponBatch验证-必须提供创建者ID");
        try {

            setDefaultCreateCouponBean();
            createcouponBean.setOperatorId(null);

            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

//            Logger.verifyEquals("2", createcouponCall.getCode(),
//                    "验证返回StatusCode值");
            Logger.verifyEquals(true,
                    createcouponCall.getMessage().contains("必须提供创建者ID"),
                    "验证返回Message值为：必须提供创建者ID");

        } catch (Exception e) {
            Logger.fail(e);
        }
    }

    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_027() {
        Logger.start(false, "反例-创建批次-CouponBatch验证-发放方式必须为短码发放或链接发放");
        try {

            setDefaultCreateCouponBean();
            createcouponBean.setSendType(4);

            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

//            Logger.verifyEquals("2", createcouponCall.getCode(),
//                    "验证返回StatusCode值");
            Logger.verifyEquals(true,
                    createcouponCall.getMessage().contains("发放方式必须为短码发放或链接发放"),
                    "验证返回Message值为：发放方式必须为短码发放或链接发放");

        } catch (Exception e) {
            Logger.fail(e);
        }
    }

    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_031() {
        Logger.start(false, "反例-创建批次-CouponBatch验证-平台创建优惠卷必须提供预备金");
        try {

            setDefaultCreateCouponBean();
            createcouponBean.setImpresetInvoiceId(null);

            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

//            Logger.verifyEquals("2", createcouponCall.getCode(),
//                    "验证返回StatusCode值");
            Logger.verifyEquals(true,
                    createcouponCall.getMessage().contains("平台创建优惠卷必须提供预备金"),
                    "验证返回Message值为：平台创建优惠卷必须提供预备金");

        } catch (Exception e) {
            Logger.fail(e);
        }
    }

    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_032() {
        Logger.start(false, "反例-创建批次-CouponBatch验证-平台创建优惠卷必须提供申请部门");
        try {

            setDefaultCreateCouponBean();
            createcouponBean.setDepartment(null);

            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

//            Logger.verifyEquals("2", createcouponCall.getCode(),
//                    "验证返回StatusCode值");
            Logger.verifyEquals(true,
                    createcouponCall.getMessage().contains("平台创建优惠卷必须提供申请部门"),
                    "验证返回Message值为：平台创建优惠卷必须提供申请部门");

        } catch (Exception e) {
            Logger.fail(e);
        }
    }

    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_035() {
        Logger.start(true, "反例-创建批次-CouponBatch验证-链接发放方式单卷使用次数必须为1");
        try {

            setDefaultCreateCouponBean();
            createcouponBean.setSendType(2);
            createcouponBean.setPerCouponMaxUseCount(2);

            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

//            Logger.verifyEquals("2", createcouponCall.getCode(),
//                    "验证返回StatusCode值");
            Logger.verifyEquals(true,
                    createcouponCall.getMessage().contains("单券使用次数必须为1"),
                    "验证返回Message值为：单券使用次数必须为1");

        } catch (Exception e) {
            Logger.fail(e);
        }
    }
    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_106() {
        Logger.start(true, "正例-创建批次-CouponUseType验证-抵现金CouponUseType=1");
        try {

            setDefaultCreateCouponBean();
            createcouponBean.setCouponUseType(1);

            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();
             
            verifyReturn();

        } catch (Exception e) {
            Logger.fail(e);
        }
    }
    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_107() {
        Logger.start(true, "正例-创建批次-CouponUseType验证-返红包CouponUseType=2");
        try {

            setDefaultCreateCouponBean();
            createcouponBean.setCouponUseType(2);

            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();
             
            verifyReturn();

        } catch (Exception e) {
            Logger.fail(e);
        }
    }
    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_036() {
        Logger.start(false, "反例-创建批次-CouponUseType验证-优惠卷使用类型错误");
        try {

            setDefaultCreateCouponBean();
            createcouponBean.setCouponUseType(5);

            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

//            Logger.verifyEquals("2", createcouponCall.getCode(),
//                    "验证返回StatusCode值");
            Logger.verifyEquals(true,
                    createcouponCall.getMessage().contains("优惠卷使用类型错误"),
                    "验证返回Message值为：优惠卷使用类型错误");

        } catch (Exception e) {
            Logger.fail(e);
        }
    }

    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_037() {
        Logger.start(false, "反例-创建批次-PerUserReceiveMaxCount验证-单用户使用最大次数不能小于0");
        try {

            setDefaultCreateCouponBean();
            createcouponBean.setPerUserReceiveMaxCount(-1);

            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

//            Logger.verifyEquals("2", createcouponCall.getCode(),
//                    "验证返回StatusCode值");
            Logger.verifyEquals(true,
                    createcouponCall.getMessage().contains("perUserReceiveMaxCount:单用户最大使用次数必须大于0"),
                    "验证返回Message值为：perUserReceiveMaxCount:单用户最大使用次数必须大于0");

        } catch (Exception e) {
            Logger.fail(e);
        }
    }

    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_038() {
        Logger.start(false, "反例-创建批次-PerCouponMaxUseCount验证-本批次最大使用次数必须大于0");
        try {

            setDefaultCreateCouponBean();
            createcouponBean.setPerCouponMaxUseCount(-1);

            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

            Logger.verifyEquals(true,
                    createcouponCall.getMessage().contains("perCouponMaxUseCount:单卷码限用次数必须大于0"),
                    "验证返回Message值为：perCouponMaxUseCount:单卷码限用次数必须大于0");

        } catch (Exception e) {
            Logger.fail(e);
        }
    }

    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_042() {
        Logger.start(false, "反例-创建批次-EffectiveType验证-有效期类型错误");
        try {

            setDefaultCreateCouponBean();
            createcouponBean.setEffectiveType(5);

            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

            Logger.verifyEquals(true,
                    createcouponCall.getMessage().contains("有效期类型错误"),
                    "验证返回Message值为：有效期类型错误");

        } catch (Exception e) {
            Logger.fail(e);
        }
    }

    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_043() {
        Logger.start(false, "反例-创建批次-Couponbatch验证-相对有效期生效方式错误");
        try {

            setDefaultCreateCouponBean();
            createcouponBean.setSendType(2);
            createcouponBean.setEffectiveType(1);
            createcouponBean.setEffectiveValidType(6);//0：立即生效1：隔天生效
            createcouponBean.setPerCouponMaxUseCount(1);

            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

//            Logger.verifyEquals("2", createcouponCall.getCode(),
//                    "验证返回StatusCode值");
            Logger.verifyEquals(true,
                    createcouponCall.getMessage().contains("相对有效期生效方式错误"),
                    "验证返回Message值为：相对有效期生效方式错误");

        } catch (Exception e) {
            Logger.fail(e);
        }
    }

    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_044() {
        Logger.start(false, "反例-创建批次-CouponSetting验证-相对有效期有效天数必须大于0");
        try {

            setDefaultCreateCouponBean();
            setDefaultCreateCouponBean();
            createcouponBean.setSendType(2);
            createcouponBean.setEffectiveType(1);
            createcouponBean.setEffectiveValidType(1);
            createcouponBean.setPerCouponMaxUseCount(1);
            createcouponBean.setEffectiveDays(0);

            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

//            Logger.verifyEquals("2", createcouponCall.getCode(),
//                    "验证返回StatusCode值");
            Logger.verifyEquals(true,
                    createcouponCall.getMessage().contains("相对有效期有效天数必须大于0"),
                    "验证返回Message值为：相对有效期有效天数必须大于0");

        } catch (Exception e) {
            Logger.fail(e);
        }
    }

    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_045() {
        Logger.start(false, "反例-创建批次-CouponSetting验证-绝对有效期错误-setting.ValidEnd < setting.ValidStart");
        try {
            Date dNow = new Date(); // 当前时间
            Date dBefore = new Date();
            Date dAfter = new Date();

            Calendar calendar1 = Calendar.getInstance(); // 得到日历
            calendar1.setTime(dNow);// 把当前时间赋给日历
            calendar1.add(Calendar.DAY_OF_MONTH, -1); // 设置为前一天
            dBefore = calendar1.getTime(); // 得到前一天的时间

            Calendar calendar2 = Calendar.getInstance(); // 得到日历
            calendar2.setTime(dNow);// 把当前时间赋给日历
            calendar2.add(Calendar.DAY_OF_MONTH, 10); // 设置为后十天
            dAfter = calendar2.getTime(); // 得到前一天的时间

            setDefaultCreateCouponBean();
            createcouponBean.setEffectiveType(0);
            createcouponBean.setValidEnd(dBefore);
            createcouponBean.setValidStart(dAfter);

            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

//            Logger.verifyEquals("2", createcouponCall.getCode(),
//                    "验证返回StatusCode值");
            Logger.verifyEquals(false,
                    createcouponCall.getMessage().contains("绝对有效期错误"),
                    "验证返回Message值为：绝对有效期错误");

        } catch (Exception e) {
            Logger.fail(e);
        }
    }

    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_028() {
        Logger.start(false,
                "反例-创建批次-CouponSetting验证-绝对有效期错误-setting.ValidEnd < DateTime.Now");
        try {
            Date dNow = new Date(); // 当前时间
            Date dBefore = new Date();
            Date dAfter = new Date();

            Calendar calendar1 = Calendar.getInstance(); // 得到日历
            calendar1.setTime(dNow);// 把当前时间赋给日历
            calendar1.add(Calendar.DAY_OF_MONTH, -1); // 设置为前一天
            dBefore = calendar1.getTime(); // 得到前一天的时间

            Calendar calendar2 = Calendar.getInstance(); // 得到日历
            calendar2.setTime(dNow);// 把当前时间赋给日历
            calendar2.add(Calendar.DAY_OF_MONTH, 10); // 设置为后十天
            dAfter = calendar2.getTime(); // 得到前一天的时间

            setDefaultCreateCouponBean();
            createcouponBean.setEffectiveType(0);
            createcouponBean.setValidEnd(dBefore);

            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

//            Logger.verifyEquals("2", createcouponCall.getCode(),
//                    "验证返回StatusCode值");
            Logger.verifyEquals(false,
                    createcouponCall.getMessage().contains("绝对有效期错误"),
                    "验证返回Message值为：绝对有效期错误");

        } catch (Exception e) {
            Logger.fail(e);
        }
    }

    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_046() {
        Logger.start(false, "反例-创建批次-CouponSetting验证-必须提供申请人-null");
        try {

            setDefaultCreateCouponBean();
            createcouponBean.setApplyUser(null);

            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

//            Logger.verifyEquals("2", createcouponCall.getCode(),
//                    "验证返回StatusCode值");
            Logger.verifyEquals(true,
                    createcouponCall.getMessage().contains("必须提供申请人"),
                    "验证返回Message值为：必须提供申请人");

        } catch (Exception e) {
            Logger.fail(e);
        }
    }

    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_029() {
        Logger.start(false, "反例-创建批次-CouponSetting验证-必须提供申请人-空字符");
        try {

            setDefaultCreateCouponBean();
            createcouponBean.setApplyUser("");

            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

//            Logger.verifyEquals("2", createcouponCall.getCode(),
//                    "验证返回StatusCode值");
            Logger.verifyEquals(true,
                    createcouponCall.getMessage().contains("必须提供申请人"),
                    "验证返回Message值为：必须提供申请人");

        } catch (Exception e) {
            Logger.fail(e);
        }
    }

    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_047() {
        Logger.start(false, "反例-创建批次-CouponSetting验证-必须提供申请理由-null");
        try {

            setDefaultCreateCouponBean();
            createcouponBean.setApplyMemo(null);

            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

//            Logger.verifyEquals("2", createcouponCall.getCode(),
//                    "验证返回StatusCode值");
            Logger.verifyEquals(true,
                    createcouponCall.getMessage().contains("必须提供申请理由"),
                    "验证返回Message值为：必须提供申请理由");

        } catch (Exception e) {
            Logger.fail(e);
        }
    }

    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_030() {
        Logger.start(false, "反例-创建批次-CouponSetting验证-必须提供申请理由-空字符");
        try {

            setDefaultCreateCouponBean();
            createcouponBean.setApplyMemo("");

            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

//            Logger.verifyEquals("2", createcouponCall.getCode(),
//                    "验证返回StatusCode值");
            Logger.verifyEquals(true,
                    createcouponCall.getMessage().contains("必须提供申请理由"),
                    "验证返回Message值为：必须提供申请理由");

        } catch (Exception e) {
            Logger.fail(e);
        }
    }

    /**
     * 该场景无法覆盖到
     */
    @Test
    @Category(P1.class)
    @TestCase
    @Ignore
    public void Tc_CreateCoupon_048() {
        Logger.start(false, "反例-创建批次-CouponSetting验证-优惠卷商品限制类型错误");
        try {

            setDefaultCreateCouponBean();
            createcouponBean.setOperatorId(null);

            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

//            Logger.verifyEquals("2", createcouponCall.getCode(),
//                    "验证返回StatusCode值");
            Logger.verifyEquals(true,
                    createcouponCall.getMessage().contains("必须提供创建者ID"),
                    "验证返回Message值为：必须提供创建者ID");

        } catch (Exception e) {
            Logger.fail(e);
        }
    }

    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_049() {
        Logger.start(false, "反例-创建批次-UserType验证-用户类型错误");
        try {

            setDefaultCreateCouponBean();
            createcouponBean.setUserType(9);

            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

//            Logger.verifyEquals("2", createcouponCall.getCode(),
//                    "验证返回StatusCode值");
            Logger.verifyEquals(true,
                    createcouponCall.getMessage().contains("用户类型错误"),
                    "验证返回Message值为：用户类型错误");

        } catch (Exception e) {
            Logger.fail(e);
        }
    }

    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_050() {
        Logger.start(false, "反例-创建批次-CouponValue验证-未提供优惠卷面额-values == null");
        try {

            setDefaultCreateCouponBean();
            createcouponBean.setCouponValues(null);

            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

//            Logger.verifyEquals("2", createcouponCall.getCode(),
//                    "验证返回StatusCode值");
            Logger.verifyEquals(true,
                    createcouponCall.getMessage().contains("couponValues:未提供优惠卷面额"),
                    "验证返回Message值为：couponValues:未提供优惠卷面额");

        } catch (Exception e) {
            Logger.fail(e);
        }
    }

    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_033() {
        Logger.start(false, "反例-创建批次-CouponValue验证-未提供优惠卷面额-values.Count == 0");
        try {

            setDefaultCreateCouponBean();

            List<CouponValue> values = new ArrayList<CouponValue>();
            createcouponBean.setCouponValues(values);

            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

//            Logger.verifyEquals("2", createcouponCall.getCode(),
//                    "验证返回StatusCode值");
            Logger.verifyEquals(true,
                    createcouponCall.getMessage().contains("couponValues:未提供优惠卷面额"),
                    "验证返回Message值为：couponValues:未提供优惠卷面额");

        } catch (Exception e) {
            Logger.fail(e);
        }
    }

    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_051() {
        Logger.start(false, "反例-创建批次-CouponValue验证-能够抵扣的金额必须大于0");
        try {

            setDefaultCreateCouponBean();

            List<CouponValue> values = new ArrayList<CouponValue>();
            CouponValue value = new CouponValue();
            value.setDeductionMaxAmount(new BigDecimal(-1));
            values.add(value);
            createcouponBean.setCouponValues(values);

            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

//            Logger.verifyEquals("2", createcouponCall.getCode(),
//                    "验证返回StatusCode值");
            Logger.verifyEquals(true,
                    createcouponCall.getMessage().contains("能够抵扣的金额必须大于0"),
                    "验证返回Message值为：能够抵扣的金额必须大于0");

        } catch (Exception e) {
            Logger.fail(e);
        }
    }

    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_052() {
        Logger.start(false, "反例-创建批次-CouponValue验证-订单满多少金额必须大于0");
        try {

            setDefaultCreateCouponBean();

            List<CouponValue> values = new ArrayList<CouponValue>();
            CouponValue value = new CouponValue();
            value.setDeductionMaxAmount(new BigDecimal(1));
            value.setOrderMinAmount(new BigDecimal(0));
            values.add(value);
            createcouponBean.setCouponValues(values);

            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

//            Logger.verifyEquals("2", createcouponCall.getCode(),
//                    "验证返回StatusCode值");
            Logger.verifyEquals(true,
                    createcouponCall.getMessage().contains("订单满多少金额必须大于0"),
                    "验证返回Message值为：订单满多少金额必须大于0");

        } catch (Exception e) {
            Logger.fail(e);
        }
    }

    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_053() {
        Logger.start(false, "反例-创建批次-CouponValue验证-订单满足金额必须大于可以抵扣的金额");
        try {

            setDefaultCreateCouponBean();

            List<CouponValue> values = new ArrayList<CouponValue>();
            CouponValue value = new CouponValue();
            value.setDeductionMaxAmount(new BigDecimal(2));
            value.setOrderMinAmount(new BigDecimal(1));
            values.add(value);
            createcouponBean.setCouponValues(values);

            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

//            Logger.verifyEquals("2", createcouponCall.getCode(),
//                    "验证返回StatusCode值");
            Logger.verifyEquals(
                    true,
                    createcouponCall.getMessage().contains("订单满足金额必须大于可以抵扣的金额"),
                    "验证返回Message值为：订单满足金额必须大于可以抵扣的金额");

        } catch (Exception e) {
            Logger.fail(e);
        }
    }

    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_054() {
        Logger.start(false, "反例-创建批次-优惠卷发放类型错误");
        try {

            setDefaultCreateCouponBean();
            createcouponBean.setSendType(3);

            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

//            Logger.verifyEquals("2", createcouponCall.getCode(),
//                    "验证返回StatusCode值");
            Logger.verifyEquals(true,
                    createcouponCall.getMessage().contains("发放方式必须为短码发放或链接发放"),
                    "验证返回Message值为：发放方式必须为短码发放或链接发放");

        } catch (Exception e) {
            Logger.fail(e);
        }
    }

    @Test
    @Category(P1.class)
    @TestCase
    @Ignore
    public void Tc_CreateCoupon_055() {
        Logger.start(false, "反例-创建批次-创建链接任务不应指定短码");
        try {

            setDefaultCreateCouponBean();
            createcouponBean.setSendType(2);
            createcouponBean.setIsCustomCouponCode(true);
            createcouponBean.setCustomCouponCode("aadf");
            createcouponBean.setPerCouponMaxUseCount(1);

            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

//            Logger.verifyEquals("2", createcouponCall.getCode(),
//                    "验证返回StatusCode值");
            Logger.verifyEquals(true,
                    createcouponCall.getMessage().contains("自定义短码必须为短码发放方式"),
                    "验证返回Message值为：自定义短码必须为短码发放方式");

        } catch (Exception e) {
            Logger.fail(e);
        }
    }

    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_056() {
        Logger.start(false, "反例-创建批次-链接发放单卷使用次数必须等于1");
        try {

            setDefaultCreateCouponBean();
            createcouponBean.setSendType(2);
            createcouponBean.setPerCouponMaxUseCount(2);

            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

//            Logger.verifyEquals("2", createcouponCall.getCode(),
//                    "验证返回StatusCode值");
            Logger.verifyEquals(true,
                    createcouponCall.getMessage().contains("单券使用次数必须为1"),
                    "验证返回Message值为：单券使用次数必须为1");

        } catch (Exception e) {
            Logger.fail(e);
        }
    }

   
    @Test
    @Category(P1.class)
    @TestCase
    @Ignore
    public void Tc_CreateCoupon_058() {
        Logger.start(true, "反例-创建批次-自定义短码必须为短码发放方式");
        try {

            setDefaultCreateCouponBean();
            createcouponBean.setIsCustomCouponCode(true);
            createcouponBean.setSendType(2);
            createcouponBean.setPerCouponMaxUseCount(1);
            createcouponBean.setCustomCouponCode("ASDF");

            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

//            Logger.verifyEquals("2", createcouponCall.getCode(),
//                    "验证返回StatusCode值");
            Logger.verifyEquals(true,
                    createcouponCall.getMessage().contains("自定义短码必须为短码发放方式"),
                    "验证返回Message值为：自定义短码必须为短码发放方式");

        } catch (Exception e) {
            Logger.fail(e);
        }
    }

    /**
     * 场景无法重新
     */
    @Test
    @Category(P1.class)
    @TestCase
    @Ignore
    public void Tc_CreateCoupon_061() {
        Logger.start(true, "反例-创建批次-Usage错误");
        try {

        } catch (Exception e) {
            Logger.fail(e);
        }
    }

    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_039() {
        Logger.start(false, "反例-创建批次-可为空的对象必须具有一个值");
        try {

            createcouponBean.setIsCustomCouponCode(true);
            createcouponBean.setSendType(1);
            createcouponBean.setPerCouponMaxUseCount(1);
            createcouponBean.setCouponNum(2);

            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

            Logger.verifyEquals("1", createcouponCall.getCode(),
                    "验证返回StatusCode值");
         
        } catch (Exception e) {
            Logger.fail(e);
        }
    }

    @Test
    @Category(P1.class)
    @TestCase
    @Ignore
    public void Tc_CreateCoupon_091() {
        Logger.start(true, "压测，验证创建100w短码需要时间");
        try {

            setDefaultCreateCouponBean();
//            int oldSequenceCount = new YmtCouponSequenceWapper()
//                   
            
            createcouponBean.setCouponName("yace100wduanma");
            createcouponBean.setCouponNum(1000000);
            
            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

//            verifyReturn(oldSequenceCount);
            
            Date d1 = new Date();

			Logger.comment("开始时间："+d1.toLocaleString());
			
			String batchCode = createcouponCall.getBatchCode();

			couponbatch batch = new couponbatchWapper().selectBybatchCode(batchCode).get(0);
			
			List<YmtCoupon> coupons = new YmtCouponWapper().selectByiBatchId(batch.getBatchId());

			int flag = 0;
			while (coupons.size() < 1000000 && flag < 50) {
				Thread.sleep(60000);
				coupons = new YmtCouponWapper().selectByiBatchId(batch.getBatchId());
				flag++;
				
				Logger.comment("第"+flag+"分钟共生成"+coupons.size()+"条记录，当前时间："+new Date().toLocaleString());				
			}
	
			Date d2=new Date();
			Logger.comment("总共花费时间:"+(d2.getTime()-d1.getTime())/(1000*60)+"分钟。");

        } catch (Exception e) {
            Logger.fail(e);
        }
    }
    
    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_092() {
        Logger.start(true, "正例-创建批次-SendType为1:短码发放（需要创建子任务）-创建指定国家优惠券JIRACONN-3005");
        try {

            setDefaultCreateCouponBean();

                   
            
            List<Integer> countrys=new ArrayList<Integer>();
            countrys.add(1000);
            countrys.add(2000);
            countrys.add(3000);
            
            createcouponBean.setCountrys(countrys);
            
            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

            verifyReturn();

        } catch (Exception e) {
            Logger.fail(e);
        }
    }

    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_093() {
        Logger.start(true, "正例-创建批次-SendType为2:链接发放(创建子任务)-创建指定国家优惠券-JIRACONN-3005");
        try {
            setLinkCreateCouponBean();
            List<Integer> countrys=new ArrayList<Integer>();
            countrys.add(1000);
            countrys.add(2000);
            countrys.add(3000);
            
            createcouponBean.setCountrys(countrys);
            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

            verifyReturn();

        } catch (Exception e) {
            Logger.fail(e);
        }
    }

    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_094() {
        Logger.start(true, "正例-创建批次-兑换批次-JIRACONN-5415");
        try {
        	CouponShop2cnMCallService couponCallService = new CouponShop2cnMCallService();
        	createcouponBean = couponCallService.setDefaultPlatformCreateCouponBeanForConversion();

            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

            verifyReturn();

        } catch (Exception e) {
            Logger.fail(e);
        }
    }
    
    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_095() {
        Logger.start(true, "正例-创建批次-获取优惠券方式是兑换-JIRACONN-5415");
        try {
        	CouponShop2cnMCallService couponCallService = new CouponShop2cnMCallService();
        	createcouponBean = couponCallService.setDefaultPlatformCreateCouponBeanForConversion();

            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

            verifyReturn();

        } catch (Exception e) {
            Logger.fail(e);
        }
    }
    
    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_096() {
        Logger.start(true, "正例-创建批次-绝对有效期，领取时间大于优惠券失效时间");
        try {
        	CouponShop2cnMCallService couponCallService = new CouponShop2cnMCallService();
        	createcouponBean = couponCallService.setDefaultPlatformCreateCouponBeanForConversion();
        	
        	 Date dNow = new Date(); // 当前时间
        	 
        	 Calendar calendarstart = Calendar.getInstance(); // 得到日历
 	        calendarstart.setTime(dNow);// 把当前时间赋给日历
 	        calendarstart.add(Calendar.DAY_OF_MONTH, 2); // 设置为前一天
 	        Date dStart = calendarstart.getTime(); // 得到前一天的时间

 	        Calendar calendarend = Calendar.getInstance(); // 得到日历
 	        calendarend.setTime(dNow);// 把当前时间赋给日历
 	        calendarend.add(Calendar.DAY_OF_MONTH, 12); // 设置为后十天
 	        Date dEnd = calendarend.getTime(); // 得到前一天的时间
 	        
        	createcouponBean.setAcquireStartTime(dStart);
        	createcouponBean.setAcquireEndTime(dEnd);
        	
            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

            Logger.verifyEquals("2", createcouponCall.getCode(), "验证返回code");
            Logger.verifyIsContains("领取结束时间不能大于使用结束时间", createcouponCall.getMessage(),
                    "验证返回Message");
            
        } catch (Exception e) {
            Logger.fail(e);
        }
    }
    
    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_097() {
        Logger.start(true, "正例-创建批次-链接-指定限制商品");
        try {
        	  setDefaultCreateCouponBean();
              List<String> list = new ArrayList<String>();
              list.add("1223");
              list.add("1223sfsadf");
              list.add("1223asgdfasgd");

              createcouponBean.setProductIds(list);
              createcouponCall.setData(createcouponBean);
              createcouponCall.callService();
              verifyReturn();            
        } catch (Exception e) {
            Logger.fail(e);
        }
    }
    
    
    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_109() {
        Logger.start(false, "反例-创建批次-链接-领取方式无效");
        try {
        	  setDefaultCreateCouponBean();
        	  createcouponBean.setAcquireCouponMethod(3);
              createcouponCall.setData(createcouponBean);
              createcouponCall.callService();
        	  Logger.verifyEquals(true, createcouponCall.getMessage().contains("平台批次获取优惠券方式必须为领取或兑换"),
                      "验证 返回Message");          
        } catch (Exception e) {
            Logger.fail(e);
        }
    }
    @Test
    @Category(P1.class)
    @TestCase
    @Ignore
    public void Tc_CreateCoupon_108() {
        Logger.start(true, "正例-创建批次-批次主键序列大于CouponSequence当前序列，当前序列加200");
        try {
        	  setDefaultCreateCouponBean();
              couponbatch couponbatch=new couponbatchWapper().selectTop1BatchInfo();
              couponsequence couponsequence=new couponsequenceWapper().selectByPrimaryKey(4);
              int oldSequenceCount=couponsequence.getSequenceCount();
              if(couponbatch.getBatchId()+1<oldSequenceCount)
              {
            	  couponsequence.setSequenceCount(couponbatch.getBatchId());
            	  new couponsequenceWapper().updateByPrimaryKey(couponsequence);
              }
              createcouponCall.setData(createcouponBean);
              createcouponCall.callService();
              
              couponsequence newCouponsequence=new couponsequenceWapper().selectByPrimaryKey(4);
              newCouponsequence.setSequenceCount(oldSequenceCount);
        	  new couponsequenceWapper().updateByPrimaryKey(newCouponsequence);
        	  
        	  Logger.verifyEquals(200, couponsequence.getSequenceCount()-couponbatch.getBatchId(),
                      "验证 数据库批次主键序列大于CouponSequence当前序列，当前序列加200");
        	  
              verifyReturn();            
        } catch (Exception e) {
            Logger.fail(e);
        }
    }
    
    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_110() {
        Logger.start(true, "正例-创建批次-链接-使用团长券（迭加业务）");
        try {
        	  setDefaultCreateCouponBean();
              createcouponBean.setIsLimitGroupSponsor(true);
              
              createcouponCall.setData(createcouponBean);
              createcouponCall.callService();
              verifyReturn();            
        } catch (Exception e) {
            Logger.fail(e);
        }
    }
    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_111() {
        Logger.start(true, "正例-创建批次-链接-不使用团长券（迭加业务）");
        try {
        	  setDefaultCreateCouponBean();
              createcouponBean.setIsLimitGroupSponsor(false);
              
              createcouponCall.setData(createcouponBean);
              createcouponCall.callService();
              verifyReturn();            
        } catch (Exception e) {
            Logger.fail(e);
        }
    }
    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_112() {
        Logger.start(true, "正例-创建批次-兑换码-使用团长券（迭加业务）");
        try {
        	CouponShop2cnMCallService couponCallService = new CouponShop2cnMCallService();
        	createcouponBean = couponCallService.setDefaultPlatformCreateCouponBeanForConversion();
              createcouponBean.setIsLimitGroupSponsor(true);
              
              createcouponCall.setData(createcouponBean);
              createcouponCall.callService();
              verifyReturn();            
        } catch (Exception e) {
            Logger.fail(e);
        }
    }
    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_113() {
        Logger.start(true, "正例-创建批次-兑换码-不使用团长券（迭加业务）");
        try {
        	CouponShop2cnMCallService couponCallService = new CouponShop2cnMCallService();
        	createcouponBean = couponCallService.setDefaultPlatformCreateCouponBeanForConversion();
              createcouponBean.setIsLimitGroupSponsor(false);
              
              createcouponCall.setData(createcouponBean);
              createcouponCall.callService();
              verifyReturn();            
        } catch (Exception e) {
            Logger.fail(e);
        }
    }
    
    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_117() {
        Logger.start(false,
                "反例-创建批次-CouponSetting验证-绝对有效期错误-setting.ValidStart 不能小于1900-01-01-JIRACONN-20931");
        try {
            String string = "1800-01-01 00:00:00";
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            Date dNow=sdf.parse(string);

            setDefaultCreateCouponBean();
            createcouponBean.setEffectiveType(0);
            createcouponBean.setValidStart(dNow);

            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

            Logger.verifyEquals("2", createcouponCall.getCode(),
                    "验证返回StatusCode值");
            Logger.verifyEquals(true,
                    createcouponCall.getMessage().contains("有效期开始时间错误"),
                    "验证返回Message值为：有效期开始时间错误");

        } catch (Exception e) {
            Logger.fail(e);
        }
    }
    
    
    
    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_118() {
        Logger.start(true, "正例-创建批次-指定品牌");
        try {

            setDefaultCreateCouponBean();

            List<Integer> list = new ArrayList<Integer>();
            list.add(10102);
            list.add(10103);
            list.add(10104);

            createcouponBean.setBrands(list);
            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

            verifyReturn();

        } catch (Exception e) {
            Logger.fail(e);
        }
    }
    
    
    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_119() {
        Logger.start(true, "正例-创建批次-指定品牌+活动-迭代-JIRACONN-24285");
        try {
            setDefaultCreateCouponBean();
            List<Integer> list = new ArrayList<Integer>();
            list.add(10101);
            list.add(10102);
            list.add(10103);
            List<Integer> alist = new ArrayList<Integer>();
            alist.add(1);
            alist.add(2);
            alist.add(3);
            createcouponBean.setBrands(list);
            createcouponBean.setActivityIds(alist);
            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

            Logger.verifyEquals("0", createcouponCall.getCode(), "验证返回code");
            Logger.verifyEquals("操作成功！", createcouponCall.getMessage(),
                    "验证返回Message");
            Logger.verifyEquals(false, createcouponCall.getBatchCode().isEmpty(),
                    "验证返回BatchCode非空");

            String batchCode = createcouponCall.getBatchCode();

            // 验证表CouponBatch表
            couponbatch couponbatch = checkcouponbatch(batchCode);
            checkcouponbatchext(couponbatch.getBatchId());
            checkcouponSequence( couponbatch);
            Logger.verifyEquals(10, couponbatch.getUseConditionType(),
                    "验证限制类型为指定活动时 数据库couponbatch表中UseConditionType=10");
            
           //checkcouponusecondition
            List<couponusecondition> cslist=new couponuseconditionWapper().selectByConditionTypeAndBatchId(couponbatch.getBatchId(),3);
            Logger.verifyEquals(cslist.size(), createcouponBean.getActivityIds().size(), "验证活动返回数据库couponusecondition表条数与传入的一直");
   			int count=0;
			for(int j=0;j<cslist.size();j++){
				count++;
    			Logger.verifyEquals(createcouponBean.getActivityIds().get(j).toString(), cslist.get(j).getConditionValue(),
                      "验证限制类型为指定活动时 数据库couponusecondition表中第"+count+"个ConditionValue");
    			Logger.verifyEquals(3, cslist.get(j).getConditionType(),
                        "验证限制类型为指定活动时 数据库couponusecondition表中第"+count+"个ConditionValue");
    		    Logger.verifyEquals(true, createcouponBean.getActivityIds().contains(Integer.parseInt(cslist.get(j).getConditionValue().toString())),
                        "验证限制类型为指定活动时 数据库couponbatch表中UseConditionType=3");
			}

		  List<couponusecondition> brandlist=new couponuseconditionWapper().selectByConditionTypeAndBatchId(couponbatch.getBatchId(),6);
          Logger.verifyEquals(brandlist.size(), createcouponBean.getBrands().size(), "验证品牌返回数据库couponusecondition表条数与传入的一直");
   			int count1=0;
			for(int j=0;j<brandlist.size();j++){
				count1++;
    			Logger.verifyEquals(createcouponBean.getBrands().get(j).toString(), brandlist.get(j).getConditionValue(),
                      "验证限制类型为指定品牌时 数据库couponusecondition表中第"+count1+"个ConditionValue");
    			Logger.verifyEquals(6, brandlist.get(j).getConditionType(),
                        "验证限制类型为指定品牌时 数据库couponusecondition表中第"+count1+"个ConditionValue");
    		    Logger.verifyEquals(true, createcouponBean.getBrands().contains(Integer.parseInt(brandlist.get(j).getConditionValue())),
                        "验证限制类型为指定品牌时 数据库couponbatch表中第"+count1+"个UseConditionType=10");
			}
        } catch (Exception e) {
            Logger.fail(e);
        }
    }
    
    
    
    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_120() {
        Logger.start(true, "正例-创建批次-effectiveTimeType为1:生效时间为小时");
        try {
   
            setDefaultCreateCouponBean();
            createcouponBean.setEffectiveType(1);
            createcouponBean.setEffectiveTimeType(1);
            createcouponBean.setEffectiveDays(2);

            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

            verifyReturn();
        } catch (Exception e) {
            Logger.fail(e);
        }
    }
    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_121() {
        Logger.start(true, "正例-创建批次-couponType=4:仅直播商品能用");
        try {
   
            setDefaultCreateCouponBean();
            createcouponBean.setLimitLiveProduct(true);

            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

            verifyReturn();
        } catch (Exception e) {
            Logger.fail(e);
        }
    }
    
    
    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_122() {
        Logger.start(true, "正例-创建批次-couponType=4&&effectiveTimeType=1:仅直播商品能用且生效时间为小时");
        try {
   
            setDefaultCreateCouponBean();
            createcouponBean.setEffectiveTimeType(1);
            createcouponBean.setLimitLiveProduct(true);

            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

            verifyReturn();
        } catch (Exception e) {
            Logger.fail(e);
        }
    }
    
    
    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_123() {
        Logger.start(true, "正例-创建批次-仅限团长券指定商品");
        try {

            setDefaultCreateCouponBean();
            List<String> list = new ArrayList<String>();
            list.add("111");
            list.add("222");
            createcouponBean.setIsLimitGroupSponsor(true);
            createcouponBean.setProductIds(list);
            
            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();
            verifyReturn();

        } catch (Exception e) {
            Logger.fail(e);
        }
    }
    
    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_124() {
        Logger.start(true, "正例-创建批次-创建平台券,支持创建全球优选券，备用金不校验-JIRACONN-29416");
        try {

            setDefaultCreateCouponBean();
            List<String> list = new ArrayList<String>();
            list.add("111");
            list.add("222");
            createcouponBean.setIsLimitGroupSponsor(true);
            createcouponBean.setProductIds(list);
            //全球优选，备用金不校验
            createcouponBean.setPlatformSource(1);
            createcouponBean.setImpresetInvoiceId("");
            
            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();
            verifyReturn();

        } catch (Exception e) {
            Logger.fail(e);
        } 
    }
    
    
    
    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_125() {
        Logger.start(true, "正例-创建批次-链接-指定限优选会员-JIRACONN-32749");
        try {

            setDefaultCreateCouponBean();
            createcouponBean.setuseConditionType(12);
           

            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

            verifyReturn();

        } catch (Exception e) {
            Logger.fail(e);
        }
    }
    
    
    @Test
    @Category(P1.class)
    @TestCase
    public void Tc_CreateCoupon_126() {
        Logger.start(true, "正例-创建批次-链接-优选会员 + 指定商品-JIRACONN-32749");
        try {

            setDefaultCreateCouponBean();
            createcouponBean.setuseConditionType(13);
            List<String> list = new ArrayList<String>();
            list.add("111");
            list.add("222");
            createcouponBean.setProductIds(list);

            createcouponCall.setData(createcouponBean);
            createcouponCall.callService();

            verifyReturn();

        } catch (Exception e) {
            Logger.fail(e);
        }
    }
    private void setDefaultCreateCouponBean() {
        Logger.comment("设置短码的默认CreateCouponBean");
        createcouponBean.setCouponName("自动化创建优惠券_"
                + TestDataManager.getRandomNum(5));
        createcouponBean.setApplyMemo("自动化测试创建优惠卷");
        createcouponBean.setSendType(2);

        createcouponBean.setEffectiveType(0);
        createcouponBean.setEffectiveValidType(0);
        createcouponBean.setEffectiveDays(0); 
        createcouponBean.setEffectiveTimeType(0);
        createcouponBean.setLimitLiveProduct(false);

        Date dNow = new Date(); // 当前时间
        Date dBefore = new Date();
        Date dAfter = new Date();

        Calendar calendar1 = Calendar.getInstance(); // 得到日历
        calendar1.setTime(dNow);// 把当前时间赋给日历
        calendar1.add(Calendar.DAY_OF_MONTH, -1); // 设置为前一天
        dBefore = calendar1.getTime(); // 得到前一天的时间

        Calendar calendar2 = Calendar.getInstance(); // 得到日历
        calendar2.setTime(dNow);// 把当前时间赋给日历
        calendar2.add(Calendar.DAY_OF_MONTH, 10); // 设置为后十天
        dAfter = calendar2.getTime(); // 得到前一天的时间

        createcouponBean.setValidStart(dBefore);
        createcouponBean.setValidEnd(dAfter);

        createcouponBean.setCouponUseType(1);

        CouponValue couponValue = new CouponValue();
        couponValue.setOrderMinAmount(new BigDecimal(200));
        couponValue.setDeductionMaxAmount(new BigDecimal(10));

        List<CouponValue> couponValues = new ArrayList<CouponValue>();
        couponValues.add(couponValue);

        createcouponBean.setCouponValues(couponValues);
        createcouponBean.setCouponNum(20);
        createcouponBean.setPerCouponMaxUseCount(1);
        createcouponBean.setPerUserReceiveMaxCount(1);

        createcouponBean.setIsCustomCouponCode(false);
        createcouponBean.setCustomCouponCode("");

        createcouponBean.setUserType(0);  
        createcouponBean.setCouponDes("优惠券描述可显示给买家看");	

        List<Integer> usePlatforms = new ArrayList<Integer>();
        usePlatforms.add(1);
        usePlatforms.add(2);
        usePlatforms.add(3);

        createcouponBean.setUsePlatforms(usePlatforms);

        List<String> productIds = new ArrayList<String>();
        createcouponBean.setProductIds(productIds);

        List<Integer> sellerIds = new ArrayList<Integer>();
        createcouponBean.setSellerIds(sellerIds);

        List<Integer> activityIds = new ArrayList<Integer>();
        createcouponBean.setActivityIds(activityIds);

        List<Integer> brands = new ArrayList<Integer>();
        createcouponBean.setBrands(brands);

        List<Integer> categories = new ArrayList<Integer>();
        createcouponBean.setCategories(categories);
        
        List<Integer> countrys = new ArrayList<Integer>();
        createcouponBean.setCountrys(countrys);

        createcouponBean.setApplyUser("自动化user111");
        createcouponBean.setDepartment(1);
        createcouponBean.setImpresetInvoiceId("FBY2019053110194788");
        createcouponBean.setOperatorId(222222);
		//新增
		createcouponBean.setAcquireStartTime(dBefore);
		createcouponBean.setAcquireEndTime(dAfter);
		// 获取优惠券方式(1:领取(默认) 2:兑换)
		createcouponBean.setAcquireCouponMethod(1);
    }

    private void setLinkCreateCouponBean() {
        Logger.comment("设置链接的默认CreateCouponBean");
        setDefaultCreateCouponBean();

        createcouponBean.setPerCouponMaxUseCount(1);
        createcouponBean.setSendType(2);
    }

    private void setCustomerShortCodeCreateCouponBean() {
        Logger.comment("设置自定义短码优惠卷CreateCouponBean");
        setDefaultCreateCouponBean();
        createcouponBean.setSendType(1);
        createcouponBean.setIsCustomCouponCode(true);
        createcouponBean.setCustomCouponCode("shortcode"
                + TestDataManager.getRandomNum(10));
        createcouponBean.setCouponNum(1);
    }

    private void setCustomerLinkCreateCouponBean() {
        Logger.comment("设置自定义短码优惠卷CreateCouponBean");
        setDefaultCreateCouponBean();
        createcouponBean.setSendType(2);
        createcouponBean.setIsCustomCouponCode(true);
        createcouponBean.setCustomCouponCode("link_"
                + TestDataManager.getRandomNum(10));
        createcouponBean.setPerCouponMaxUseCount(1);
    }

   // private void verifyReturn(int oldCouponSequence)
      private void verifyReturn()
            throws InterruptedException {

        Logger.verifyEquals("0", createcouponCall.getCode(), "验证返回code");
        Logger.verifyEquals("操作成功！", createcouponCall.getMessage(),
                "验证返回Message");
        Logger.verifyEquals(false, createcouponCall.getBatchCode().isEmpty(),
                "验证返回BatchCode非空");

        String batchCode = createcouponCall.getBatchCode();

        // 验证表CouponBatch表
        couponbatch couponbatch = checkcouponbatch(batchCode);
        checkcouponbatchext(couponbatch.getBatchId());
        checkcouponusecondition(couponbatch.getBatchId());
        checkcouponSequence( couponbatch);
    }

    private couponbatch checkcouponbatch(String batchCode) {
        Logger.comment("====方法：验证数据库CouponBatch====");
        List<couponbatch> couponbatchs = new couponbatchWapper()
                .selectBybatchCode(batchCode);

        Logger.verifyEquals(1, couponbatchs.size(),
                "验证CouponBatch表生成BatchCode=" + batchCode + "的条数。");

        if (couponbatchs.size() >= 1) {
        	 couponbatch batchItem = couponbatchs.get(0);
        	 couponbatchext couponbatchext=new couponbatchextWapper().selectByPrimaryKey(batchItem.getBatchId());

             Logger.verifyEquals(
                     createcouponBean.getDepartment(),
                     couponbatchext.getApplyDepartment(),
                     "验证数据库CouponBatch表中ApplyDepartment");
             // 平台创建
             CouponValue couponValue = createcouponBean.getCouponValues().get(0);
             Logger.verifyEquals(couponValue.getOrderMinAmount().stripTrailingZeros(), batchItem.getMinOrderValue().stripTrailingZeros(),
                     "验证数据库CouponBatch表中MinOrderValue");
             Logger.verifyEquals(couponValue.getDeductionMaxAmount().stripTrailingZeros(), batchItem.getCouponValue().stripTrailingZeros(),
                     "验证数据库CouponBatch表中CouponValue");
             
             Logger.verifyEquals(1, batchItem.getCreaterType().intValue(),
                     "验证数据库CouponBatch表中CreaterType");
             Logger.verifyEquals(createcouponBean.getCouponName(),
                     batchItem.getCouponName(),
                     "验证数据库CouponBatch表中CouponName");
             Logger.verifyEquals(createcouponBean.getPerUserReceiveMaxCount(),
                     batchItem.getReceiveTimesPerUser(),
                     "验证数据库CouponBatch表中iCouponNumPerUser");

             Logger.verifyEquals(createcouponBean.getCouponNum(),
                     batchItem.getTotalNum(),
                     "验证数据库CouponBatch表中TotalNum");

             Logger.verifyEquals(createcouponBean.getImpresetInvoiceId(),
            		 couponbatchext.getImpresetInvoiceId(),
                     "验证数据库CouponBatch表中impresetInvoiceId");

             Logger.verifyEquals(false, batchItem.getIsInvalid(),
                     "验证数据库CouponBatch表中IsInvalid");
             
             Logger.verifyEquals(false, batchItem.getIsShowInPage(),
                     "验证数据库CouponBatch表中IsShowInPage");

             Logger.verifyEquals("", couponbatchext.getInvalidUser(),
                     "验证数据库CouponBatch表中InvalidUser");
             Logger.verifyEquals(createcouponBean.getApplyMemo(), couponbatchext.getApplyMemo(),
                     "验证数据库CouponBatch表中ApplyMemo");
             Logger.verifyEquals(createcouponBean.getApplyUser(), couponbatchext.getApplyUser(),
                     "验证数据库CouponBatch表中ApplyUser");

             Logger.verifyEquals(createcouponBean.getOperatorId(),
                     batchItem.getOperatorId(),
                     "验证数据库CouponBatch表中OperatorId");

             Logger.verifyEquals(createcouponBean.getSendType(),
                     batchItem.getSendType(), "验证数据库CouponBatch表中SendType");
             // 新加字段
             Logger.verifyEquals(createcouponBean.getCouponDes(), batchItem.getCouponDes(),
                     "验证数据库CouponBatch表中CouponDes");
             Logger.verifyEquals(createcouponBean.getPlatformSource(), batchItem.getPlatformSource(),
                     "验证数据库CouponBatch表中PlatformSource");
             Logger.verifyEquals(createcouponBean.getEffectiveTimeType(), batchItem.getEffectiveTimeType(),
                     "验证数据库CouponBatch表中EffectiveTimeType");
             if(createcouponBean.getIsLimitLiveProduct()==true)
             {
                Logger.verifyEquals(4, batchItem.getCouponType(),"验证数据库CouponBatch表中CouponType");
                Logger.verifyEquals(11, batchItem.getUseConditionType(),"验证数据库CouponBatch表中UseConditionType");
             }

             if(createcouponBean.getAcquireStartTime()!=null)
             {
             	Logger.verifyEquals(createcouponBean.getAcquireStartTime().toString(), batchItem.getAcquireStartTime().toString(),
                         "验证数据库CouponBatch表中AcquireStartTime");
             }
             
             if(createcouponBean.getAcquireEndTime()!=null)
             {
             	Logger.verifyEquals(createcouponBean.getAcquireEndTime().toString(), batchItem.getAcquireEndTime().toString(),
                         "验证数据库CouponBatch表中AcquireEndTime");
             }
             
             if(createcouponBean.getAcquireCouponMethod()!=null)
             {
             	Logger.verifyEquals(createcouponBean.getAcquireCouponMethod(), batchItem.getAcquireMethod().intValue(),
                         "验证数据库CouponBatch表中AcquireCouponMethod");
             }
             
             if(createcouponBean.getUsePlatforms().size()>0)
             {
            	 String str="";
            	 for(int i=0;i<createcouponBean.getUsePlatforms().size();i++)
            	 {
            		 str+=createcouponBean.getUsePlatforms().get(i)+",";
            	 }
                	Logger.verifyEquals(str.substring(0, str.length()-1), batchItem.getUsePlatformIds(),
                            "验证数据库CouponBatch表中UsePlatformIds");
//                	Logger.verifyEquals(0, batchItem.getUseConditionType(),
//                            "验证数据库CouponBatch表中UsePlatformIds");
                	
             }else
             {
             	Logger.verifyEquals("", batchItem.getUsePlatformIds(),
                        "验证数据库CouponBatch表中UsePlatformIds");
             }
            return batchItem;
        }
        return null;
    }
    private void checkcouponbatchext(int batchId)
    {
        Logger.comment("====方法：验证数据库checkcouponbatchext====");
        couponbatchext couponbatchext=new couponbatchextWapper().selectByPrimaryKey(batchId);
        Logger.verifyEquals(createcouponBean.getImpresetInvoiceId(), couponbatchext.getImpresetInvoiceId(),
                "验证数据库couponbatchext表中ImpresetInvoiceId");
        Logger.verifyEquals(createcouponBean.getDepartment(), couponbatchext.getApplyDepartment(),
                "验证数据库couponbatchext表中ApplyDepartment");
        Logger.verifyEquals(createcouponBean.getApplyUser(), couponbatchext.getApplyUser(),
                "验证数据库couponbatchext表中ApplyUser");
        Logger.verifyEquals(createcouponBean.getApplyMemo(), couponbatchext.getApplyMemo(),
                "验证数据库couponbatchext表中ApplyMemo");
        
    }
    private void checkcouponusecondition(int batchId)
    {
    	 Logger.comment("====方法：验证数据库checkcouponusecondition====");
    	List<couponusecondition> couponuseconditions=new couponuseconditionWapper().selectByBatchId(batchId);
    	couponbatch couponbatch= new couponbatchWapper().selectByPrimaryKey(batchId);
    	if(couponuseconditions.size()==0 && createcouponBean.getIsLimitGroupSponsor()==false && createcouponBean.getIsLimitLiveProduct()==false 
    			&& createcouponBean.getuseConditionType()==null)
    	{
			Logger.verifyEquals(0, couponbatch.getUseConditionType(),
                    "验证限制类型为通用时 数据库couponbatch表中UseConditionType=0");
    	}
    	if(createcouponBean.getuseConditionType()!=null)
    	{
    		Logger.verifyEquals(createcouponBean.getuseConditionType(), couponbatch.getUseConditionType(),
                    "验证限制类型为通用时 数据库couponbatch表中UseConditionType="+createcouponBean.getuseConditionType());
    	}
           //0:通用 1:指定买手，2：指定商品，3：指定活动，4：指定分类，5：指定国家，6：指定品牌，7：指定国家和分类，8：仅优先商品，9：团长券
    	//国家和分类
		if(createcouponBean.getCountrys().size()>0 && createcouponBean.getCategories().size()>0)
		{
		    Logger.verifyEquals(7, couponbatch.getUseConditionType(),
                    "验证限制类型为指定国家和分类时 数据库couponbatch表中UseConditionType=7");
		}
		if(createcouponBean.getSellerIds().size()>0)
		{
			List<couponusecondition> cslist=new couponuseconditionWapper().selectByConditionTypeAndBatchId(batchId,1);
			int count=0;
			for(int j=0;j<cslist.size();j++){
				count++;
    			Logger.verifyEquals(createcouponBean.getSellerIds().get(j).toString(), cslist.get(j).getConditionValue(),
                      "验证限制类型为指定买手时 数据库couponusecondition表中第"+count+"个ConditionValue");
    			Logger.verifyEquals(1, couponuseconditions.get(j).getConditionType(),
                        "验证限制类型为指定买手时 数据库couponbatch表中UseConditionType=1");
    			Logger.verifyEquals(1, couponbatch.getUseConditionType(),
                        "验证限制类型为指定买手时 数据库couponbatch表中UseConditionType=1");
			}
			return;
		}
		if(createcouponBean.getProductIds().size()>0)
		{
			List<couponusecondition> cslist=new couponuseconditionWapper().selectByConditionTypeAndBatchId(batchId,2);
   			int count=0;
			for(int j=0;j<cslist.size();j++){
				count++;
    			Logger.verifyEquals(createcouponBean.getProductIds().get(j).toString(), cslist.get(j).getConditionValue(),
                      "验证限制类型为指定商品时 数据库couponusecondition表中第"+count+"个ConditionValue");
   	    		   Logger.verifyEquals(2, couponuseconditions.get(j).getConditionType(),
	                        "验证限制类型为指定买手时 数据库couponbatch表中UseConditionType=2");
    			if(createcouponBean.getIsLimitGroupSponsor()==true)
				   Logger.verifyEquals(9, couponbatch.getUseConditionType(),
	                    "验证限制类型为指定商品时 数据库couponbatch表中UseConditionType=9");
    			else if(createcouponBean.getuseConditionType()!=null)//优选会员 + 指定商品
    				   Logger.verifyEquals(createcouponBean.getuseConditionType(), couponbatch.getUseConditionType(),
    	                    "验证限制类型为指定商品时 数据库couponbatch表中UseConditionType="+createcouponBean.getuseConditionType());
    			else 
   				   Logger.verifyEquals(2, couponbatch.getUseConditionType(),
   	                    "验证限制类型为指定商品时 数据库couponbatch表中UseConditionType=2");
			}
			return;
		}
		if(createcouponBean.getActivityIds().size()>0)
		{
			List<couponusecondition> cslist=new couponuseconditionWapper().selectByConditionTypeAndBatchId(batchId,3);
   			int count=0;
			for(int j=0;j<cslist.size();j++){
				count++;
    			Logger.verifyEquals(createcouponBean.getActivityIds().get(j).toString(), cslist.get(j).getConditionValue(),
                      "验证限制类型为指定活动时 数据库couponusecondition表中第"+count+"个ConditionValue");
    		    Logger.verifyEquals(3, couponuseconditions.get(j).getConditionType(),
                        "验证限制类型为指定活动时 数据库couponbatch表中UseConditionType=3");
			   Logger.verifyEquals(3, couponbatch.getUseConditionType(),
                    "验证限制类型为指定活动时 数据库couponbatch表中UseConditionType=3");
			}
			return;
		}
		if(createcouponBean.getCategories().size()>0)
		{
			List<couponusecondition> cslist=new couponuseconditionWapper().selectByConditionTypeAndBatchId(batchId,4);
   			int count=0;
			for(int j=0;j<cslist.size();j++){
				count++;
    			Logger.verifyEquals(createcouponBean.getCategories().get(j).toString(), cslist.get(j).getConditionValue(),
                      "验证限制类型为指定分类时 数据库couponusecondition表中第"+count+"个ConditionValue");
    		    Logger.verifyEquals(4, couponuseconditions.get(j).getConditionType(),
                        "验证限制类型为指定分类时 数据库couponbatch表中UseConditionType=4");
    		    if(createcouponBean.getCountrys().size()==0)
			     Logger.verifyEquals(4, couponbatch.getUseConditionType(),
                     "验证限制类型为指定分类时 数据库couponbatch表中UseConditionType=4");
			}
			return;
		}
		if(createcouponBean.getCountrys().size()>0)
		{
			List<couponusecondition> cslist=new couponuseconditionWapper().selectByConditionTypeAndBatchId(batchId,5);
   			int count=0;
			for(int j=0;j<cslist.size();j++){
				count++;
    			Logger.verifyEquals(createcouponBean.getCountrys().get(j).toString(), cslist.get(j).getConditionValue(),
                      "验证限制类型为指定国家时 数据库couponusecondition表中第"+count+"个ConditionValue");
    		    Logger.verifyEquals(5, couponuseconditions.get(j).getConditionType(),
                        "验证限制类型为指定国家时 数据库couponbatch表中UseConditionType=5");
    		    if(createcouponBean.getCategories().size()==0)
			   Logger.verifyEquals(5, couponbatch.getUseConditionType(),
                    "验证限制类型为指定国家时 数据库couponbatch表中UseConditionType=5");
			}
			return;
		}
		//品牌
		if(createcouponBean.getBrands().size()>0)
		{
			List<couponusecondition> cslist=new couponuseconditionWapper().selectByConditionTypeAndBatchId(batchId,6);
   			int count=0;
		  for(int j=0;j<cslist.size();j++){
				count++;
    			Logger.verifyEquals(createcouponBean.getBrands().get(j).toString(), cslist.get(j).getConditionValue(),
                      "验证限制类型为指定品牌时 数据库couponusecondition表中第"+count+"个ConditionValue");
    		    Logger.verifyEquals(6, couponuseconditions.get(j).getConditionType(),
                        "验证限制类型为指定品牌时 数据库couponbatch表中UseConditionType=6");
		    	Logger.verifyEquals(6, couponbatch.getUseConditionType(),
                    "验证限制类型为指定品牌时 数据库couponbatch表中UseConditionType=6");
			}
		  return;
		}
		//优先商品
		if(createcouponBean.getIsLimitPspProduct()==true)
		{
			Logger.verifyEquals(8, couponbatch.getUseConditionType(),
                    "验证限制类型为指定优先商品时 数据库couponbatch表中UseConditionType");
			Logger.verifyEquals(8, couponbatch.getUseConditionType(),
                    "验证限制类型为优选商品时 数据库couponbatch表中UseConditionType=8");
			return;
		}
		//团长券
		if(createcouponBean.getIsLimitGroupSponsor()==true)
		{
			Logger.verifyEquals(9, couponbatch.getUseConditionType(),
                    "验证限制类型为团长券时 数据库couponbatch表中UseConditionType");
		}
    }
    private void checkYmtCouponValue(int iCouponSettingId) {
        // 验证Ymt_CouponValue表
        Logger.comment("====方法：验证数据库YmtCouponValue====");

        List<YmtCouponValue> valuelist = new YmtCouponValueWapper()
                .selectByiCouponSettingId(iCouponSettingId);

        Logger.verifyEquals(createcouponBean.getCouponValues().size(),
                valuelist.size(), "验证Ymt_CouponValue表生成iCouponSettingId="
                        + iCouponSettingId + "条数正确");

        for (int i = 0; i < valuelist.size(); i++) {
            YmtCouponValue valueItem = valuelist.get(i);
            CouponValue couponValue = createcouponBean.getCouponValues().get(i);
            Logger.verifyEquals(couponValue.getDeductionMaxAmount(),
                    new BigDecimal(valueItem.getFcouponvalue().floatValue()),
                    "验证数据库Ymt_CouponValue表中Fcouponvalue");
            Logger.verifyEquals(couponValue.getOrderMinAmount(),
                    new BigDecimal(valueItem.getFminordervalue().floatValue()),
                    "验证数据库Ymt_CouponValue表中Fminordervalue");
        }
    }

//    private YmtCouponSetting checkYmtCouponSetting(couponbatch batchItem) {
////        Logger.comment("====方法：验证数据库YmtCouponSetting====");
////
//////        List<YmtCouponSetting> settinglist = new YmtCouponSettingWapper()
//////                .selectByiCouponSettingId(batchItem.getiCouponSettingId());
////
//////        Logger.verifyEquals(
//////                1,
//////                settinglist.size(),
//////                "验证Ymt_CouponSetting表生成iCouponSettingId="
//////                        + batchItem.getiCouponSettingId() + "条数正确");
////
////        if (settinglist.size() >= 1) {
////            YmtCouponSetting settingItem = settinglist.get(0);
////
////            Logger.verifyEquals(createcouponBean.getApplyMemo(),
////                    settingItem.getsApplyMemo(),
////                    "验证数据库Ymt_CouponSetting表中sApplyMemo");
////
////            Logger.verifyEquals(createcouponBean.getApplyUser(),
////                    settingItem.getsApplyUser(),
////                    "验证数据库Ymt_CouponSetting表中sApplyUser");
////
////            Logger.verifyEquals(createcouponBean.getPerCouponMaxUseCount(),
////                    settingItem.getiCouponUseCount(),
////                    "验证数据库Ymt_CouponSetting表中iCouponUseCount");
////
////            Logger.verifyEquals(createcouponBean.getCouponUseType(),
////                    settingItem.getiCouponUseType(),
////                    "验证数据库Ymt_CouponSetting表中iCouponUseType");
////
////            Logger.verifyEquals(createcouponBean.getEffectiveDays(),
////                    settingItem.getiEffectiveDays(),
////                    "验证数据库Ymt_CouponSetting表中iEffectiveDays");
////
////            Logger.verifyEquals(createcouponBean.getEffectiveType(),
////                    settingItem.getiEffectiveType(),
////                    "验证数据库Ymt_CouponSetting表中iEffectiveType");
////
////            Logger.verifyEquals(createcouponBean.getEffectiveValidType(),
////                    settingItem.getiEffectiveValidType(),
////                    "验证数据库Ymt_CouponSetting表中iEffectiveValidType");
////
////            Logger.verifyEquals(false, settingItem.getbIsMobileVerify(),
////                    "验证数据库Ymt_CouponSetting表中bIsMobileVerify");
////
////            Logger.verifyEquals(
////                    batchItem.getCouponTotalNum()
////                            * settingItem.getiCouponUseCount(),
////                    settingItem.getiMaxUseTime(),
////                    "验证数据库Ymt_CouponSetting表中iMaxUseTime");
////
////            Logger.verifyEquals(createcouponBean.getPerUserReceiveMaxCount(),
////                    settingItem.getiMaxUseTimePerUser(),
////                    "验证数据库Ymt_CouponSetting表中iMaxUseTimePerUser");
////
////            Logger.verifyEquals(0, settingItem.getiReceiveCount(),
////                    "验证数据库Ymt_CouponSetting表中iReceiveCount");
////
//////            if (isNullOrEmplty(createcouponBean.getSellerIds())
//////                    && isNullOrEmplty(createcouponBean.getProductIds())
//////                    && isNullOrEmplty(createcouponBean.getActivityIds())
//////                    && isNullOrEmplty(createcouponBean.getBrands())
//////                    && isNullOrEmplty(createcouponBean.getCategories())) {
//////                Logger.verifyEquals(1, settingItem.getiScenarioType(),
//////                        "验证数据库Ymt_CouponSetting表中iScenarioType");
//////            } else {
//////                Logger.verifyEquals(2, settingItem.getiScenarioType(),
//////                        "验证数据库Ymt_CouponSetting表中iScenarioType");
//////            }
////
////            Logger.verifyEquals(settingItem.getiMaxUseTime(),
////                    settingItem.getiUseTotalCount(),
////                    "验证数据库Ymt_CouponSetting表中iUseTotalCount");
////            
//////            if(createcouponBean.isLimitPspProduct())
//////            {
//////            	 Logger.verifyEquals(8, settingItem.getiScenarioType(),
//////                       "验证数据库Ymt_CouponSetting表中iScenarioType");
//////            }
////
////            // iScenarioType
////            // 0:通用 1:指定买手，2：指定商品，3：指定活动，4：指定分类，5：指定国家，6：指定品牌，7：指定国家和分类，8：仅优先商品
////            if (settingItem.getiEffectiveValidType() == 0) {
////                Logger.verifyEquals(createcouponBean.getValidStart()
////                        .toLocaleString(), settingItem.getdValidStart()
////                        .toLocaleString(),
////                        "验证数据库Ymt_CouponSetting表中dValidStart");
////                // 验证setting.ValidEnd = request.ValidEnd.Value.Date.AddDays(1);
////
////                Date date = createcouponBean.getValidEnd();
////                Date dnew = new Date();
////
////                Calendar calendar1 = Calendar.getInstance(); // 得到日历
////                calendar1.setTime(date);// 把当前时间赋给日历
////                calendar1.add(Calendar.DAY_OF_MONTH, +1); // 设置为前一天
////                dnew = calendar1.getTime(); // 得到前一天的时间
////
////                SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
//////                String dateString = formatter.format(date) + " 23:59:59";
////                SimpleDateFormat formatter2 = new SimpleDateFormat(
////                        "yyyy-MM-dd HH:mm:ss");
////                String dateString = formatter2.format(date) ;
////
////                Logger.verifyEquals(dateString,
////                        formatter2.format(settingItem.getdValidEnd()),
////                        "验证数据库Ymt_CouponSetting表中dValidEnd");
////
////            } else {
////                Logger.verifyEquals(new Date("1900-1-1"),
////                        settingItem.getdValidStart(),
////                        "验证数据库Ymt_CouponSetting表中dValidStart");
////
////                Logger.verifyEquals(new Date("1900-01-01 23:59:59"),
////                        settingItem.getdValidEnd(),
////                        "验证数据库Ymt_CouponSetting表中dValidEnd");
////            }
////
////            Logger.verifyEquals(createcouponBean.getEffectiveValidType(),
////                    settingItem.getiEffectiveValidType(),
////                    "验证数据库Ymt_CouponSetting表中iEffectiveValidType");
////
////            return settingItem;
////        }
////        return null;
//    }

    private void checkYmtCouponScenario(int iCouponScenarioId) {
        Logger.comment("====方法：验证数据库YmtCouponScenario====");

        List<YmtCouponScenario> scenariolist = new YmtCouponScenarioWapper()
                .selectByiCouponScenarioId(iCouponScenarioId);

        Logger.verifyEquals(1, scenariolist.size(),
                "验证Ymt_CouponScenario表生成iCouponScenarioId=" + iCouponScenarioId
                        + "条数正确");

        if (scenariolist.size() >= 1) {
            YmtCouponScenario scenarioItem = scenariolist.get(0);

            if (createcouponBean.getActivityIds() != null
                    && createcouponBean.getActivityIds().size() > 0) {
                Logger.verifyEquals(getList(createcouponBean.getActivityIds()),
                        scenarioItem.getSactivityids(),
                        "验证数据库Ymt_CouponScenario表中Sactivityids");
            } else {
                Logger.verifyEquals("", scenarioItem.getSactivityids(),
                        "验证数据库Ymt_CouponScenario表中Sactivityids");
            }

            Logger.verifyEquals(null, scenarioItem.getSlogisticstypes(),
                    "验证数据库Ymt_CouponScenario表中Slogisticstypes");

            if (createcouponBean.getBrands() != null
                    && createcouponBean.getBrands().size() > 0) {
                Logger.verifyEquals(getList(createcouponBean.getBrands()),
                        scenarioItem.getSproductbrands(),
                        "验证数据库Ymt_CouponScenario表中Sproductbrands");
            } else {
                Logger.verifyEquals("", scenarioItem.getSproductbrands(),
                        "验证数据库Ymt_CouponScenario表中Sproductbrands");
            }

            if (createcouponBean.getCategories() != null
                    && createcouponBean.getCategories().size() > 0) {
                Logger.verifyEquals(getList(createcouponBean.getCategories()),
                        scenarioItem.getSproductcategories(),
                        "验证数据库Ymt_CouponScenario表中Sproductcategories");
            } else {
                Logger.verifyEquals("", scenarioItem.getSproductcategories(),
                        "验证数据库Ymt_CouponScenario表中Sproductcategories");
            }

            if (createcouponBean.getSellerIds() != null
                    && createcouponBean.getSellerIds().size() > 0) {
                Logger.verifyEquals(getList(createcouponBean.getSellerIds()),
                        scenarioItem.getSsellerids(),
                        "验证数据库Ymt_CouponScenario表中Ssellerid");
            } else {
                Logger.verifyEquals("", scenarioItem.getSsellerids(),
                        "验证数据库Ymt_CouponScenario表中Ssellerid");
            }
            Logger.verifyEquals(null, scenarioItem.getSstockstatus(),
                    "验证数据库Ymt_CouponScenario表中Sstockstatus");

            if (createcouponBean.getUsePlatforms() != null
                    && createcouponBean.getUsePlatforms().size() > 0) {
                Logger.verifyEquals(
                        getList(createcouponBean.getUsePlatforms()),
                        scenarioItem.getSuseplatforms(),
                        "验证数据库Ymt_CouponScenario表中Suseplatforms");
            } else {
                Logger.verifyEquals("", scenarioItem.getSuseplatforms(),
                        "验证数据库Ymt_CouponScenario表中Suseplatforms");
            }

            Logger.verifyEquals(null, scenarioItem.getSuserlevels(),
                    "验证数据库Ymt_CouponScenario表中Suserlevels");

            Logger.verifyEquals(createcouponBean.getUserType(),
                    scenarioItem.getIusertype(),
                    "验证数据库Ymt_CouponScenario表中Iusertype");
            
            if (createcouponBean.getCountrys() != null
                    && createcouponBean.getCountrys().size() > 0) {
                Logger.verifyEquals(getList(createcouponBean.getCountrys()),
                        scenarioItem.getScountrys(),
                        "验证数据库Ymt_CouponScenario表中sCountrys");
            } else {
                Logger.verifyEquals(null, scenarioItem.getScountrys(),
                        "验证数据库Ymt_CouponScenario表中sCountrys");
            }
        }
    }

    private void checkcouponSequence(couponbatch couponbatch )
    {
    	 Logger.comment("====方法：验证数据库checkcouponSequence====");
    	 couponsequence couponSequence=new couponsequenceWapper().selectByPrimaryKey(4);
    	 if(couponbatch.getBatchId()>couponSequence.getSequenceCount())
    	 {	
    		 Logger.verifyEquals(true, couponSequence.getSequenceCount()-couponbatch.getBatchId()<200,
                     "验证 数据库couponbatch表的主键batchId大于couponSequence序列基数时，序列加200");
    	 }
    	 
    }
  

    private void checkYmtCoupon(int iBatchId) {
        Logger.comment("====方法：验证数据库Coupon====");

        List<coupon> coupons = new couponWapper()
                .selectByBatchId(iBatchId);

        if (createcouponBean.getSendType() == 1
                || createcouponBean.getSendType() == 2
                && createcouponBean.getIsCustomCouponCode()) {

            Logger.verifyEquals(createcouponBean.getCouponNum(),
                    coupons.size(), "验证coupon表生成BatchId=" + iBatchId
                            + "条数正确");

            int num = 1;
            for (coupon coupon : coupons) {
                Logger.comment("验证第" + num + "条记录，CouponCode：" + coupon.getCouponCode());
                num++;
//                Logger.verifyEquals(settingItem.getiCouponSettingId(),
//                        coupon.getCouponSetting(),
//                        "验证数据库Ymt_Coupon表中iCouponSettingId");
//                Logger.verifyEquals(1,
//                        coupon.getCouponType(), "验证数据库Coupon表中SendType");
//                Logger.verifyEquals(1, coupon.getiUsage(),
//                        "验证数据库Ymt_Coupon表中iUsage");
//                Logger.verifyEquals(settingItem.getdValidStart(),
//                        coupon.getValidStart(), "验证数据库Coupon表中ValidStart");
//                Logger.verifyEquals(settingItem.getdValidEnd(),
//                        coupon.getValidEnd(), "验证数据库Coupon表中ValidEnd");

                if (createcouponBean.getIsCustomCouponCode() == true) {
                    Logger.verifyEquals(createcouponBean.getCustomCouponCode(),
                            coupon.getCouponCode(),
                            "验证数据库Coupon表中CouponCode");
                }
            }
        }
    }

//    private void checkYmtCouponProduct(int batchId)
//    {
//    	Logger.comment("====方法：验证数据库YmtCouponProduct====");
//    	List<YmtCouponProduct> products = new YmtCouponProductWapper().selectBysBatchId(batchId);
//			
//    	  if (createcouponBean.getProductIds() != null
//                  && createcouponBean.getProductIds().size() > 0) {
//          	
//  			Logger.verifyEquals(createcouponBean.getProductIds().size(), products.size(), "验证YmtCouponProduct表生成相应记录数");
//  			
//  			List<String> productList = new ArrayList<>();
//  			for(int i=0;i<products.size();i++)
//  			{
//  				productList.add(products.get(i).getProductCode());
//  			}
//  			
//  			Logger.verifyEquals(true,TestDataManager.isListEqual(createcouponBean.getProductIds(), productList), "验证YmtCouponProduct表productCodes");
//  			
//          } else {
//        	  Logger.verifyEquals(0, products.size(), "验证YmtCouponProduct表生成相应记录数");    			
//          }
//    }
    
    private String getList(List<Integer> list) {
        StringBuffer sBuffer = new StringBuffer();
        for (Integer integer : list) {
            sBuffer.append(integer);
            sBuffer.append(",");
        }
        if (sBuffer.length() > 0) {    
            sBuffer.deleteCharAt(sBuffer.length() - 1);
        }
        return sBuffer.toString();
    }

    private boolean isNullOrEmplty(List<Integer> list) {
        return list == null || list.size() == 0;
    }

}